package cn.com.utt.common.message;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;

public class Upload extends Message {
	@JSONField(name = "replyto")
	private String replyTo;
	@JSONField(name = "method")
	private String method;
	@JSONField(name = "filename")
	private String filename;
	@JSONField(name = "url")
	private String URL;
	@JSONField(name = "token")
	private String token;

	public Upload() {
		setType(MessageType.UPLOAD.toString());
	}

	@Override
	public String encode() {
		return JSON.toJSONString(this);
	}

	@Override
	public void decode(byte[] buf) {
		Upload upload = JSON.parseObject(buf, Upload.class);
		this.setId(upload.getId());
		this.replyTo = upload.getReplyTo();
		this.URL = upload.getURL();
		this.method = upload.getMethod();
		this.filename = upload.getFilename();
		this.token = upload.getToken();
	}

	public String getReplyTo() {
		return replyTo;
	}

	public void setReplyTo(String replyTo) {
		this.replyTo = replyTo;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public String getURL() {
		return URL;
	}

	public void setURL(String uRL) {
		URL = uRL;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

}
